package com.example.crm.service.impl;

import com.example.crm.dao.IUserDAO;
import com.example.crm.dao.impl.UserDAOImpl;
import com.example.crm.service.IUserService;

import java.sql.SQLException;

public class UserServiceImpl implements IUserService
{
    @Override
    public boolean login(String username, String password) {

        // 调用DAO查询
//        return (int)(Math.random()*2)==0;

        IUserDAO userDAO = new UserDAOImpl();
        try {
            boolean result = userDAO.findByUseranmePassword(username    ,password);
            return result;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }
}
